/**
 * Copyright &copy; 2012-2015 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.soccer.cms.modules.sys.utils;

import java.util.List;

import com.google.common.collect.Lists;
import com.soccer.cms.common.utils.SpringContextHolder;

import com.soccer.cms.modules.sys.entity.Dictitem;
import com.soccer.cms.modules.sys.dao.DictitemDao;

/**
 * 字典项管理Utils
 * @author zouqh
 * @version 2015-05-26
 */
public class DictitemUtils {

	private static DictitemDao dictitemDao = SpringContextHolder.getBean(DictitemDao.class);
	
	public static Dictitem getDictitem(String id) {
		return dictitemDao.get(id);
	}
	
	public static List<Dictitem> getDictitemList() {
		List<Dictitem> dictitems = null;
		Dictitem dictitem = new Dictitem();
		dictitems = dictitemDao.findList(dictitem);
		if(dictitems == null){
			dictitems = Lists.newArrayList();
		}
		return dictitems;
	}
	
	public static Dictitem getDictitemByCode(String code) {
		List<Dictitem> dictitems = null;
		Dictitem dictitem = new Dictitem();
		dictitem.setCode(code);
		dictitems = dictitemDao.findList(dictitem);
		if(dictitems == null){
			dictitems = Lists.newArrayList();
		}
		return dictitems.get(0);
	}
	
}